package com.loong.controller;

import com.google.gson.Gson;
import com.loong.pojo.Type;
import com.loong.service.TypeService;
import com.loong.service.impl.TypeServiceImpl;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.util.List;

@WebServlet("/type")
public class TypeController extends BaseServlet{

    public String findAll(HttpServletRequest request, HttpServletResponse response){
        TypeService typeService = new TypeServiceImpl();
        List<Type> types = typeService.findAll();
        Gson gson = new Gson();
        return gson.toJson(types);
    }
}
